package com.bw.zonghe0719.Login

import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.bw.base.mvvm.BaseActivity
import com.bw.zonghe0719.R
import com.bw.zonghe0719.databinding.ActivityUserBinding
@Route(path = "/app/login/UserActivity")
class UserActivity : BaseActivity<ActivityUserBinding,LoginViewModel>() {
    override fun initView() {
        viewModel.userInfo()
        binding.toUpdate.setOnClickListener {
            startActivity(Intent(this,UpdateActivity::class.java))
        }
    }

    override fun initData() {
        viewModel.userInfoSuccess.observe(this){
            if(it.code==200){
                //用数据绑定的形式显示数据
                binding.info=it.data
            }
        }
    }

    override fun getViewModel(): Class<LoginViewModel> {
        return LoginViewModel::class.java
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_user
    }
}